Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function initDev( exampleFiles: ExampleFilesPayload ): void {
].map( ( filename ) => ( {
path: join( exampleFilesDir, 'phylip', filename ),
} ) );
const useFiles = [].concat( useFastaFiles, usePhylipFiles );
const useFiles = [ ...useFastaFiles, ...usePhylipFiles ];
store.activeRun.addAlignments( useFiles );
store.activeRun.setOutputDir( exampleFiles.outdir );
setTimeout( () => {
Expand Down
3 changes: 2 additions & 1 deletion src/app/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const stemOf = ( baseName: string ): string => {
const parsed = ( filePath: string ): { base: string; name: string; dir: string } => {
const sep = sepOf( filePath );
const chunks = filePath.split( /[/\\]/ );
const baseName = chunks.pop();
// split() always returns at least one chunk, so pop() never yields undefined.
const baseName = chunks.pop() ?? '';
let directory = '';
if ( chunks.length === 1 && chunks[0] === '' ) {
directory = sep;
Expand Down
7 changes: 5 additions & 2 deletions src/main/modelSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ export async function runModelSelection(
// Each '> [program]' is written three times, for BIC, AIC and AICc respectively. Use AICc.
const cmdRaxml = commands.filter( ( cmd ) => cmd.startsWith( ' > raxmlHPC-SSE3' ) )[2];
const cmdRaxmlNG = commands.filter( ( cmd ) => cmd.startsWith( ' > raxml-ng' ) )[2];
const modelRaxml = /-m (\S+)/.exec( cmdRaxml )[1];
const modelRaxml = /-m (\S+)/.exec( cmdRaxml )?.[1];
const extraFlag = /--(\S+)/.exec( cmdRaxml )?.[0];
const modelRaxmlNG = /--model (\S+)/.exec( cmdRaxmlNG )[1];
const modelRaxmlNG = /--model (\S+)/.exec( cmdRaxmlNG )?.[1];
if ( !modelRaxml || !modelRaxmlNG ) {
throw new Error( 'No best-model command in modeltest-ng output' );
}
console.log( `-> raxml: ${modelRaxml}, extraFlag: ${extraFlag}, raxml-ng: ${modelRaxmlNG}` );
send( event, ipc.ALIGNMENT_MODEL_SELECTION_SUCCESS, {
id,
Expand Down
5 changes: 3 additions & 2 deletions src/main/processHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ export async function runProcess(
let exited = false;
// Last stdout only: the binary prints its fatal reason just before exiting.
let stdoutTail = '';
proc.stdout.on( 'data', ( buffer: string | Buffer ) => {
// execFile always opens stdout and stderr pipes; the optional chain only satisfies their nullable type.
proc.stdout?.on( 'data', ( buffer: string | Buffer ) => {
const content = String( buffer );
stdoutTail = ( stdoutTail + content ).slice( -8192 );
console.log( 'on stdout:', content );
onStdOut( content );
send( event, ipc.RUN_STDOUT, { id, content } );
} );
proc.stderr.on( 'data', ( buffer: string | Buffer ) => {
proc.stderr?.on( 'data', ( buffer: string | Buffer ) => {
const content = String( buffer );
console.error( 'on stderr:', content );
onStdErr( content );
Expand Down
Loading