mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Tail now accepts PID
This commit is contained in:
parent
d2d6453a78
commit
a8d0b6e13d
@ -53,7 +53,11 @@ import { Player } from "./Player";
|
|||||||
import { hackWorldDaemon } from "./RedPill";
|
import { hackWorldDaemon } from "./RedPill";
|
||||||
import { RunningScript } from "./Script/RunningScript";
|
import { RunningScript } from "./Script/RunningScript";
|
||||||
import { getRamUsageFromRunningScript } from "./Script/RunningScriptHelpers";
|
import { getRamUsageFromRunningScript } from "./Script/RunningScriptHelpers";
|
||||||
import { getCurrentEditor, findRunningScript } from "./Script/ScriptHelpers";
|
import {
|
||||||
|
getCurrentEditor,
|
||||||
|
findRunningScript,
|
||||||
|
findRunningScriptByPid,
|
||||||
|
} from "./Script/ScriptHelpers";
|
||||||
import { isScriptFilename } from "./Script/ScriptHelpersTS";
|
import { isScriptFilename } from "./Script/ScriptHelpersTS";
|
||||||
import { AllServers } from "./Server/AllServers";
|
import { AllServers } from "./Server/AllServers";
|
||||||
import {
|
import {
|
||||||
@ -1406,9 +1410,10 @@ let Terminal = {
|
|||||||
if (commandArray.length < 2) {
|
if (commandArray.length < 2) {
|
||||||
postError("Incorrect number of arguments. Usage: tail [script] [arg1] [arg2]...");
|
postError("Incorrect number of arguments. Usage: tail [script] [arg1] [arg2]...");
|
||||||
} else {
|
} else {
|
||||||
|
if(typeof commandArray[1] === 'string') {
|
||||||
const scriptName = Terminal.getFilepath(commandArray[1]);
|
const scriptName = Terminal.getFilepath(commandArray[1]);
|
||||||
if (!isScriptFilename(scriptName)) {
|
if (!isScriptFilename(scriptName)) {
|
||||||
postError("tail can only be called on .script files (filename must end with .script)");
|
postError("tail can only be called on .script, .ns, .js files, or by pid");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,6 +1430,14 @@ let Terminal = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logBoxCreate(runningScript);
|
logBoxCreate(runningScript);
|
||||||
|
} else {
|
||||||
|
const runningScript = findRunningScriptByPid(commandArray[1], Player.getCurrentServer());
|
||||||
|
if (runningScript == null) {
|
||||||
|
postError("No such script exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logBoxCreate(runningScript);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
Terminal.postThrownError(e);
|
Terminal.postThrownError(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user