mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Await scp multiple script copy
This commit is contained in:
parent
7d6947ee01
commit
3437a0a730
@ -1056,12 +1056,16 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
}
|
}
|
||||||
if (scriptname && scriptname.constructor === Array) {
|
if (scriptname && scriptname.constructor === Array) {
|
||||||
// Recursively call scp on all elements of array
|
// Recursively call scp on all elements of array
|
||||||
let res = false;
|
const scripts: Array<string> = scriptname;
|
||||||
await scriptname.forEach(async function (script) {
|
if (scripts.length === 0) {
|
||||||
if (await NetscriptFunctions(workerScript).scp(script, hostname1, hostname2)) {
|
throw makeRuntimeErrorMsg("scp", "No scripts to copy");
|
||||||
res = true;
|
|
||||||
}
|
}
|
||||||
});
|
let res = true;
|
||||||
|
await Promise.all(scripts.map(async function(script) {
|
||||||
|
if (!await NetscriptFunctions(workerScript).scp(script, hostname1, hostname2)) {
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
}));
|
||||||
return Promise.resolve(res);
|
return Promise.resolve(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user