Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gource does not stop simulation when reading from STDIN #334

Open
Crown0815 opened this issue Jan 8, 2025 · 7 comments
Open

Gource does not stop simulation when reading from STDIN #334

Crown0815 opened this issue Jan 8, 2025 · 7 comments

Comments

@Crown0815
Copy link

I have a powershell script to generate a mp4 video using gource. The script looks like this:

$Command = @"
`$CombinedLog ``
| gource ``
    --load-config ./gource.config ``
    --path - ``
    --log-format custom ``
    --seconds-per-day $SecondsPerDay ``
    --output-ppm-stream - ``
| ffmpeg ``
    -i - ``
    -y ``
    -vcodec ppm ``
    -vcodec libx264 ``
    -preset veryfast ``
    -pix_fmt yuv420p ``
    -crf 1 ``
    -filter:v "setpts=PTS/2" ``
    -threads 0 ``
    -bf 0 ``
    $VideoOutput
"@

# Execute the command
if ($PSCmdlet.ShouldProcess($CombinedLog, "$Command")){
    Invoke-Expression $Command
}

Overall the script does what it should. The issue I have is that at the end of the $CombinedLog, the gource simulation does not terminate.
The reason I use a $CombinedLog is that I am merging multiple repositories.
Is there any way to tell gource that the stream is finished?
The stream currently consists of concatenated newline-separated lines in a single string.

@mschilli87
Copy link

Did you try ending your stream with ^D? I am not familiar with Windows. Othrwise consider writing the stream to a (temporary) file and passing that to gource.

@Crown0815
Copy link
Author

Crown0815 commented Jan 8, 2025

@mschilli87, I am running PowerShell on MacOS, but I do not think it makes much of a difference since PowerShell is cross-platform? I tried adding ^D to the end, but so far did not get any effect.

I tried:

$CombinedLog += "`^D"

(which I am aware is very naive)

and

$CombinedLog += [char]4

Neither worked.

The temporary file solution works and was my original approach. I just would like to avoid temporary files lying around in case the script is aborted. Streaming seems like the perfect solution for that.

The simulation also stops if the StopDate is within the streamed lines, but not if the stream ends. Is this maybe a Bug?

@mschilli87
Copy link

By ^D I meant Ctrl+D. I don't use powershell so I don't know how to do that. I just think that gource keeps waiting for more input because the stream is not terminated.

@Crown0815
Copy link
Author

@mschilli87 yes, I think that [char]4 should do the trick since this is the EOT byte, right?
How would you do that in e.g. bash? Maybe I can translate it to pwsh, but I would not even know how to do it in bash.

@mschilli87
Copy link

In bash one can type Ctrl+V followed by Ctrl+D IIRC.

@Crown0815
Copy link
Author

And within a bash script?
Is that possible?

@mschilli87
Copy link

I meant when writing the script you can use Ctrl+V followed by Ctrl+D to enter a literal Ctrl+D . This way you can use printf and cat or sed or any other tool to edit the stream to append it to your stream. But I never had to do this is bash. And I don't know powershell. I just doubt there is any issue with gource but rather with your script. If you replace gource by wc, do you get a word count or is it also waiting for more input?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants