File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 11import { type SpawnOptions , type SpawnOptionsWithoutStdio , spawn } from 'node:child_process' ;
2+ import { isAbsolute } from 'node:path' ;
23
34import { run } from './outputs.js' ;
45
@@ -11,8 +12,10 @@ const windowsOptions: SpawnOptions = {
1112 * Run child process and returns stdout and stderr to user stout
1213 */
1314const spawnPromised = async ( cmd : string , args : string [ ] , opts : SpawnOptionsWithoutStdio ) => {
15+ const escapedCommand = isAbsolute ( cmd ) && process . platform === 'win32' ? `"${ cmd } "` : cmd ;
16+
1417 // NOTE: Pipes stderr, stdout to main process
15- const childProcess = spawn ( cmd , args , {
18+ const childProcess = spawn ( escapedCommand , args , {
1619 ...opts ,
1720 stdio : process . env . APIFY_NO_LOGS_IN_TESTS ? 'ignore' : 'inherit' ,
1821 ...( process . platform === 'win32' ? windowsOptions : { } ) ,
Original file line number Diff line number Diff line change 1+ import { existsSync } from 'node:fs' ;
2+
3+ import { useTempPath } from '../../__setup__/hooks/useTempPath.js' ;
4+
5+ const actName = 'create-my-spaced-actor' ;
6+ const { beforeAllCalls, afterAllCalls, joinPath } = useTempPath ( 'spaced actor' , {
7+ create : true ,
8+ remove : true ,
9+ cwd : true ,
10+ cwdParent : false ,
11+ } ) ;
12+
13+ const { CreateCommand } = await import ( '../../../src/commands/create.js' ) ;
14+
15+ describe . runIf ( process . env . FORCE_WINDOWS_TESTS || process . platform === 'win32' ) ( 'apify create on windows' , ( ) => {
16+ beforeEach ( async ( ) => {
17+ await beforeAllCalls ( ) ;
18+ } ) ;
19+
20+ afterEach ( async ( ) => {
21+ await afterAllCalls ( ) ;
22+ } ) ;
23+
24+ it ( 'works for creating an actor when the folder path contains spaces' , async ( ) => {
25+ const ACT_TEMPLATE = 'python-playwright' ;
26+ await CreateCommand . run ( [ actName , '--template' , ACT_TEMPLATE ] , import . meta. url ) ;
27+
28+ // check files structure
29+ expect ( existsSync ( joinPath ( actName ) ) ) . toBeTruthy ( ) ;
30+ } ) ;
31+ } ) ;
You can’t perform that action at this time.
0 commit comments