Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the runCommand functionality by extracting input and output video information gathering into separate functions, and optimizes subprocess management by removing redundant stdin cleanup.
- Extracted video information gathering logic into dedicated functions for better code organization
- Simplified subprocess management by removing duplicate stdin.end() call
- Improved code maintainability through function separation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/runCommand.ts | Refactored runCommand by extracting getInputVideoInfo and getOutputVideoInfo functions |
| src/main/childProcessManager.ts | Removed redundant ffmpeg.proc.stdin.end() call from safeUnpipe function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| async function getInputVideoInfo(event: IpcMainEvent, video: string): Promise<{ | ||
| hasAudio: boolean | ||
| hasSubtitle: boolean | ||
| videoStream: any | ||
| }> { |
There was a problem hiding this comment.
The videoStream property should have a more specific type instead of 'any'. Consider defining an interface for the video stream structure or using a union type that represents the expected ffprobe output format.
| async function getOutputVideoInfo(event: IpcMainEvent, vpyPath: string): Promise<{ | ||
| width: string | ||
| height: string | ||
| frames: string | ||
| fps: string | ||
| }> { |
There was a problem hiding this comment.
Consider using more specific types for numeric properties. Properties like width, height, frames could be number instead of string, and fps could be a number representing frames per second.
1, runcommand 功能划分
2, 子进程管理优化