Skip to content

Commit 90b8e93

Browse files
committed
fix: Fix bugs with the test command
1 parent 7c26073 commit 90b8e93

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/orchestrators/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const TestOrchestrator = {
5151

5252
// Run this in the background. The user will have to manually exit the GUI to stop the test.
5353
// We bind mount the codify installation and the codify config directory. We choose not use :ro (read-only) because live changes are not supported in read-only mode.
54-
spawnSafe(`tart run ${vmName} --dir=codify-lib:${codifyInstall}:ro --dir=codify-config:${path.dirname(initializationResult.project.codifyFiles[0])}:ro`, { interactive: true })
54+
spawnSafe(`tart run ${vmName} --dir=codify-lib:${codifyInstall}:ro --dir='codify-config:${path.dirname(initializationResult.project.codifyFiles[0])}:ro'`, { interactive: true })
5555
.finally(() => {
5656
ctx.subprocessFinished(SubProcessName.TEST_USER_CONTINUE_ON_VM);
5757
ctx.subprocessStarted(SubProcessName.TEST_DELETING_VM);
@@ -75,7 +75,7 @@ export const TestOrchestrator = {
7575

7676
try {
7777
// Add symlinks to the bind mount locations.
78-
await spawn(`tart exec ${vmName} sudo ln -s /Volumes/My\\ Shared\\ Files/codify-lib/bin/codify /usr/local/bin/codify`, { interactive: true });
78+
await spawn(`tart exec ${vmName} sudo ln -s /Volumes/My\\ Shared\\ Files/codify-lib/bin/codify /usr/local/bin/codify`, { interactive: true, allowSudoInCommand: true });
7979
await spawn(`tart exec ${vmName} ln -s /Volumes/My\\ Shared\\ Files/codify-config/${path.basename(initializationResult.project.codifyFiles[0])} /Users/admin/codify.jsonc`, { interactive: true });
8080

8181
// Launch terminal and run codify apply
@@ -166,7 +166,7 @@ export const TestOrchestrator = {
166166
try {
167167
// Copy the updated config file to the VM
168168
// This command will fail but it causes the bind mount to update for some reason. (seems like a bug in Tart). Leave this here for now.
169-
await spawn(`sshpass -p "admin" scp -o PubkeyAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${filePath} admin@${ip}:~/codify.jsonc`, { interactive: true });
169+
await spawn(`sshpass -p "admin" scp -o PubkeyAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${filePath}' admin@${ip}:~/codify.jsonc`, { interactive: true });
170170
// ctx.log('Config file synced successfully');
171171
} catch (error) {
172172
// ctx.log(`Error syncing config file: ${error}`);

src/utils/spawn.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface SpawnOptions {
2020
requiresRoot?: boolean,
2121
stdin?: boolean,
2222
timeout?: number,
23+
allowSudoInCommand?: boolean,
2324
}
2425

2526
export async function spawn(cmd: string, options?: SpawnOptions, pluginName?: string, password?: string): Promise<SpawnResult> {
@@ -37,7 +38,7 @@ export async function spawnSafe(cmd: string, options?: SpawnOptions, pluginName?
3738
throw new Error('Password must be specified!');
3839
}
3940

40-
if (cmd.toLowerCase().includes('sudo')) {
41+
if (cmd.toLowerCase().includes('sudo') && !options?.allowSudoInCommand) {
4142
throw new Error(`Command must not include sudo. Plugin (${pluginName})`)
4243
}
4344

0 commit comments

Comments
 (0)