Skip to content

SwiftPM prefetch kills wrong process #185831

Description

@vashworth

Despite landing #184831, this code is still killing processes that don't match the argument list

// Check if process is already running from a previous Flutter command. If it is, kill it
// so we don't have the process running twice. When this process is run twice, it'll cause
// one to error. The new process will pick up where the old one left off.
final RunResult result = await _processUtils.run([
'pgrep',
'-n', // Select only the newest
'-f', // Match against full argument lists
...command,
]);
if (result.exitCode == 0) {
final int? pid = int.tryParse(result.stdout.trim());
if (pid != null) {
_logger.printTrace(
'Swift Package Manager dependencies are already being fetched by PID $pid',
);
await _processUtils.run(['kill', '$pid']);
}
}
}

Related: #184754

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions