mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Improve script init failure message
This commit is contained in:
parent
f689e6a2ea
commit
f2c5561eac
1 changed files with 15 additions and 10 deletions
|
@ -31,18 +31,23 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ShellControl controlWithScripts(ShellControl pc, List<DataStoreEntryRef<ScriptStore>> initScripts, List<DataStoreEntryRef<ScriptStore>> bringScripts) {
|
public static ShellControl controlWithScripts(ShellControl pc, List<DataStoreEntryRef<ScriptStore>> initScripts, List<DataStoreEntryRef<ScriptStore>> bringScripts) {
|
||||||
var initFlattened = flatten(initScripts);
|
try {
|
||||||
var bringFlattened = flatten(bringScripts);
|
var initFlattened = flatten(initScripts);
|
||||||
|
var bringFlattened = flatten(bringScripts);
|
||||||
|
|
||||||
pc.onInit(shellControl -> {
|
pc.onInit(shellControl -> {
|
||||||
passInitScripts(pc, initFlattened);
|
passInitScripts(pc, initFlattened);
|
||||||
|
|
||||||
var dir = initScriptsDirectory(shellControl, bringFlattened);
|
var dir = initScriptsDirectory(shellControl, bringFlattened);
|
||||||
if (dir != null) {
|
if (dir != null) {
|
||||||
shellControl.withInitSnippet(new SimpleScriptSnippet(shellControl.getShellDialect().appendToPathVariableCommand(dir), ScriptSnippet.ExecutionType.TERMINAL_ONLY));
|
shellControl.withInitSnippet(new SimpleScriptSnippet(shellControl.getShellDialect().appendToPathVariableCommand(dir),
|
||||||
}
|
ScriptSnippet.ExecutionType.TERMINAL_ONLY));
|
||||||
});
|
}
|
||||||
return pc;
|
});
|
||||||
|
return pc;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new RuntimeException("Unable to set up scripts", t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void passInitScripts(ShellControl pc, List<SimpleScriptStore> scriptStores) throws Exception {
|
private static void passInitScripts(ShellControl pc, List<SimpleScriptStore> scriptStores) throws Exception {
|
||||||
|
|
Loading…
Reference in a new issue