@@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
import path from 'node:path' ;
3
3
import process from 'node:process' ;
4
4
import degit from 'degit' ;
5
- import { exec } from 'tinyexec' ;
5
+ import { x , exec } from 'tinyexec' ;
6
6
import { create } from '@sveltejs/create' ;
7
7
8
8
export { addPnpmBuildDependencies } from '../utils/package-manager.ts' ;
@@ -83,7 +83,7 @@ export function createProject({ cwd, testName, templatesDir }: CreateOptions): C
83
83
type PreviewOptions = { cwd : string ; command ?: string } ;
84
84
export async function startPreview ( {
85
85
cwd,
86
- command = 'npm run preview'
86
+ command = 'pnpm preview'
87
87
} : PreviewOptions ) : Promise < { url : string ; close : ( ) => Promise < void > } > {
88
88
const [ cmd , ...args ] = command . split ( ' ' ) ;
89
89
const proc = exec ( cmd , args , {
@@ -124,7 +124,7 @@ export async function startPreview({
124
124
async function terminate ( pid : number ) {
125
125
try {
126
126
if ( process . platform === 'win32' ) {
127
- await exec ( ` taskkill /pid ${ pid } /T /F` ) ; // on windows, use taskkill to terminate the process tree
127
+ await x ( ' taskkill' , [ '/PID' , ` ${ pid } ` , '/T' , '/F' ] ) ; // on windows, use taskkill to terminate the process tree
128
128
} else {
129
129
process . kill ( - pid , 'SIGTERM' ) ; // Kill the process group
130
130
}
0 commit comments