Skip to content

Commit b427255

Browse files
committed
remove explicitly specifying longRunning command and infer from command itself
1 parent ee5c850 commit b427255

File tree

6 files changed

+9
-21
lines changed

6 files changed

+9
-21
lines changed

src/lib/import-export/export/export-database.ts

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export async function exportDatabaseToFile(
2121
`sqlite export ${ tempFileName } --require=/tmp/sqlite-command/command.php`,
2222
{
2323
skipPluginsAndThemes: true,
24-
longRunning: true,
2524
}
2625
);
2726

@@ -89,7 +88,6 @@ export async function exportDatabaseToMultipleFiles(
8988
`sqlite export ${ fileName } --tables=${ table } --require=/tmp/sqlite-command/command.php`,
9089
{
9190
skipPluginsAndThemes: true,
92-
longRunning: true,
9391
}
9492
);
9593

src/lib/import-export/import/importers/importer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract class BaseImporter extends EventEmitter implements Importer {
5757
const { stderr, exitCode } = await server.executeWpCliCommand(
5858
`sqlite import ${ sqlTempFile } --require=/tmp/sqlite-command/command.php`,
5959
// SQLite plugin requires PHP 8+
60-
{ targetPhpVersion: DEFAULT_PHP_VERSION, skipPluginsAndThemes: true, longRunning: true }
60+
{ targetPhpVersion: DEFAULT_PHP_VERSION, skipPluginsAndThemes: true }
6161
);
6262

6363
if ( stderr ) {

src/lib/import-export/tests/export/exporters/sql-exporter.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ platformTestSuite( 'SqlExporter', ( { normalize } ) => {
6161
const siteServer = SiteServer.get( '123' );
6262
expect( siteServer?.executeWpCliCommand ).toHaveBeenCalledWith(
6363
'sqlite export studio-backup-db-export-2024-08-01-12-00-00.sql --require=/tmp/sqlite-command/command.php',
64-
{ skipPluginsAndThemes: true, longRunning: true }
64+
{ skipPluginsAndThemes: true }
6565
);
6666
} );
6767

src/lib/import-export/tests/import/importer/jetpack-importer.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ platformTestSuite( 'JetpackImporter', ( { normalize } ) => {
8787
expect( siteServer?.executeWpCliCommand ).toHaveBeenNthCalledWith( 1, expectedCommand, {
8888
targetPhpVersion: '8.2',
8989
skipPluginsAndThemes: true,
90-
longRunning: true,
9190
} );
9291
expect( siteServer?.executeWpCliCommand ).toHaveBeenNthCalledWith( 2, expectedCommand, {
9392
targetPhpVersion: '8.2',
9493
skipPluginsAndThemes: true,
95-
longRunning: true,
9694
} );
9795

9896
const expectedUnlinkPath = normalize(

src/lib/wp-cli-process.ts

+6-12
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,19 @@ export default class WpCliProcess {
5555

5656
async execute(
5757
args: string[],
58-
{
59-
phpVersion,
60-
longRunning = false,
61-
}: {
62-
phpVersion?: string;
63-
longRunning?: boolean;
64-
} = {}
58+
{ phpVersion }: { phpVersion?: string } = {}
6559
): Promise< WpCliResult > {
6660
const message = 'execute';
6761
const messageId = this.sendMessage( message, {
6862
projectPath: this.projectPath,
6963
args,
7064
phpVersion,
7165
} );
72-
return await this.waitForResponse(
73-
message,
74-
messageId,
75-
longRunning ? IMPORT_EXPORT_RESPONSE_TIMEOUT : DEFAULT_RESPONSE_TIMEOUT
76-
);
66+
const timeout =
67+
args[ 0 ] === 'sqlite' && ( args[ 1 ] === 'import' || args[ 1 ] === 'export' )
68+
? IMPORT_EXPORT_RESPONSE_TIMEOUT
69+
: DEFAULT_RESPONSE_TIMEOUT;
70+
return await this.waitForResponse( message, messageId, timeout );
7771
}
7872

7973
async stop() {

src/site-server.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,9 @@ export class SiteServer {
170170
{
171171
targetPhpVersion,
172172
skipPluginsAndThemes = false,
173-
longRunning = false,
174173
}: {
175174
targetPhpVersion?: string;
176175
skipPluginsAndThemes?: boolean;
177-
longRunning?: boolean;
178176
} = {}
179177
): Promise< WpCliResult > {
180178
const projectPath = this.details.path;
@@ -201,7 +199,7 @@ export class SiteServer {
201199
}
202200

203201
try {
204-
return await this.wpCliExecutor.execute( wpCliArgs as string[], { phpVersion, longRunning } );
202+
return await this.wpCliExecutor.execute( wpCliArgs as string[], { phpVersion } );
205203
} catch ( error ) {
206204
if ( ( error as MessageCanceled )?.canceled ) {
207205
return {

0 commit comments

Comments
 (0)