-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.ps1
executable file
·39 lines (29 loc) · 903 Bytes
/
run.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env -S pwsh-preview -noProfile -nologo
# Start from powershell
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', '')]
param()
$log = "${HOME}/loupedeck_runner.log"
$tmuxSession = & tmux ls 2>/dev/null | grep -i -q "loupedeck" && echo $?
$currentPath = $PSScriptRoot
push-location $currentPath
try {
if ($null -ne $tmuxSession){
& tmux kill-server
echo 'Killed server'
$command = 'node ./examples/custom/index.mjs'
$tmuxSession = & tmux new-session -d -s "loupedeck" $command
bash -c "$tmuxSession 2>&1>$log"
sleep 2
& tmux kill-server
sleep 2
}
$command = 'node ./examples/custom/index.mjs';
$tmuxSession = & tmux new-session -d -s "loupedeck" $command
bash -c "$tmuxSession 2>&1>$log"
echo "Started Loupedeck"
} catch {
echo $_
}
finally {
pop-location
}