mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53: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,25 +1410,34 @@ 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 {
|
||||||
const scriptName = Terminal.getFilepath(commandArray[1]);
|
if(typeof commandArray[1] === 'string') {
|
||||||
if (!isScriptFilename(scriptName)) {
|
const scriptName = Terminal.getFilepath(commandArray[1]);
|
||||||
postError("tail can only be called on .script files (filename must end with .script)");
|
if (!isScriptFilename(scriptName)) {
|
||||||
return;
|
postError("tail can only be called on .script, .ns, .js files, or by pid");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get script arguments
|
// Get script arguments
|
||||||
const args = [];
|
const args = [];
|
||||||
for (let i = 2; i < commandArray.length; ++i) {
|
for (let i = 2; i < commandArray.length; ++i) {
|
||||||
args.push(commandArray[i]);
|
args.push(commandArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the script exists on this machine
|
// Check that the script exists on this machine
|
||||||
const runningScript = findRunningScript(scriptName, args, s);
|
const runningScript = findRunningScript(scriptName, args, s);
|
||||||
if (runningScript == null) {
|
if (runningScript == null) {
|
||||||
postError("No such script exists");
|
postError("No such script exists");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
logBoxCreate(runningScript);
|
||||||
|
} else {
|
||||||
|
const runningScript = findRunningScriptByPid(commandArray[1], Player.getCurrentServer());
|
||||||
|
if (runningScript == null) {
|
||||||
|
postError("No such script exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logBoxCreate(runningScript);
|
||||||
}
|
}
|
||||||
logBoxCreate(runningScript);
|
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
Terminal.postThrownError(e);
|
Terminal.postThrownError(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user