Skip to content

multiple invocations collide in tmpdir, crash #183

@paulp

Description

@paulp

Steps To Reproduce The Error

Invoke imageoptim a second time on the same machine.

Expected Behaviour

Both runs complete successfully.

Actual Behaviour

When the first one completes, it expunges the temporary directory which both processes are using. The other immediately crashes:

i Running ImageOptim...
! ENOENT: no such file or directory, stat '/var/folders/ct/vwmp17px5lq96n7vrqf8fhqh0000gn/T/imageoptim-cli/image123.jpg'
! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues    

Version Numbers or N/A

N/A

Help Needed

Invocations should each use a unique temporary directory. I'm unfamiliar with this language, but on the command line you can see what mktemp does:

% /usr/bin/mktemp -d
/var/folders/ct/vwmp17px5lq96n7vrqf8fhqh0000gn/T/tmp.oe1HyPEd

The string oe1HyPEd in this example is there to prevent bugs of this kind.

Fixing this probably only requires a tweak to this line but at the moment I don't have time to familiarize myself enough to send a PR. If needed I will come back to this. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions