@@ -32570,18 +32570,46 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
3257032570const core_1 = __nccwpck_require__(2186);
3257132571const params_1 = __nccwpck_require__(5966);
3257232572const child_process_1 = __nccwpck_require__(2081);
32573+ const dcdVersionString = '@devicecloud.dev/dcd@>=3.3.6';
3257332574const escapeShellValue = (value) => {
3257432575 // Escape special characters that could cause shell interpretation issues
3257532576 return value.replace(/(["\\'$`!\s\[\]{}()&|;<>*?#^~])/g, '\\$1');
3257632577};
32578+ const executeCommand = (command, log = true) => {
32579+ return new Promise((resolve, reject) => {
32580+ const [cmd, ...args] = command.split(' ');
32581+ let output = '';
32582+ const process = (0, child_process_1.spawn)(cmd, args, { shell: true });
32583+ process.stdout.on('data', (data) => {
32584+ const chunk = data.toString();
32585+ output += chunk;
32586+ if (log) {
32587+ console.info(chunk);
32588+ }
32589+ });
32590+ process.stderr.on('data', (data) => {
32591+ const chunk = data.toString();
32592+ output += chunk;
32593+ if (log) {
32594+ console.error(chunk);
32595+ }
32596+ });
32597+ process.on('close', (code) => {
32598+ resolve({ output, exitCode: code !== null && code !== void 0 ? code : 0 });
32599+ });
32600+ process.on('error', (err) => {
32601+ reject(err);
32602+ });
32603+ });
32604+ };
3257732605const getTestStatus = (uploadId, apiKey, apiUrl) => __awaiter(void 0, void 0, void 0, function* () {
3257832606 try {
32579- let command = `npx --yes @devicecloud.dev/dcd status --json --upload-id ${uploadId} --api-key ${escapeShellValue(apiKey)}`;
32607+ let command = `npx --yes "${dcdVersionString}" status --json --upload-id ${uploadId} --api-key ${escapeShellValue(apiKey)}`;
3258032608 if (apiUrl) {
3258132609 command += ` --api-url ${escapeShellValue(apiUrl)}`;
3258232610 }
32583- const statusOutput = (0, child_process_1.execSync) (command, { encoding: 'utf-8' } );
32584- return JSON.parse(statusOutput );
32611+ const { output } = yield executeCommand (command, false );
32612+ return JSON.parse(output );
3258532613 }
3258632614 catch (error) {
3258732615 console.warn('Failed to get test status:', error);
@@ -32640,13 +32668,10 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
3264032668 }
3264132669 // Execute the test command and capture the upload ID
3264232670 let uploadId = null;
32643- let testOutput;
32671+ let testOutput = '' ;
3264432672 try {
32645- testOutput = (0, child_process_1.execSync)(`npx --yes --no-cache @devicecloud.dev/dcd cloud ${paramsString} --quiet`, { encoding: 'utf-8' });
32646- }
32647- catch (e) {
32648- testOutput = e.output[1].toString();
32649- const exitCode = e.status || 1;
32673+ const { output, exitCode } = yield executeCommand(`npx --yes "${dcdVersionString}" cloud ${paramsString} --quiet`);
32674+ testOutput = output;
3265032675 if (exitCode === 1) {
3265132676 throw new Error('DeviceCloud CLI failed to run - check your parameters or contact support');
3265232677 }
@@ -32675,7 +32700,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
3267532700 console.info('Successfully completed test run.');
3267632701 }
3267732702 else if (result.status === 'FAILED') {
32678- (0, core_1.setFailed)(' Test run failed. Check flow results for details.' );
32703+ (0, core_1.setFailed)(` Test run failed. Check flow results for details: ${result.consoleUrl}` );
3267932704 }
3268032705 }
3268132706 else {
0 commit comments