我在PowerShell窗口中输入以下命令:
(Start-Process powershell {.\scripts\skiptest\lockfile.bat} -Passthru).ID > .\pid.txt
假设保存在pid.txt中的PID是1234。lockfile.bat
的内容是:
@ECHO OFF
powershell.exe -command "$lock=[System.IO.File]::Open('Parse.java','Open','ReadWrite','None');Write-Host -NoNewLine 'Press any key to release the file...';$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')"
现在,当我尝试使用命令杀死较新的PowerShell:
Stop-Process -Force -Id 1234
它不会关闭。如何关闭它?
答案 0 :(得分:-1)
import { ACCESS_TOKEN, API_BASE_URL } from '../constants';
export function request (options) {
const headers = {
'Content-Type': 'application/json',
}
if (localStorage.getItem(ACCESS_TOKEN)) {
headers.append('Authorzation', 'Bearer ' + localStorage.getItem(ACCESS_TOKEN))
}
return fetch(API_BASE_URL+options.url, {
method: options.method,
headers: headers,
body: options.body
})
.then(function(response){
// Falta pegar o token e gravar na local estorage
if (!response.ok) {
return Promise.reject(json);
}
return json;
});
};