Skip to content

Create leading directories to the log file #144

Open
@yarikoptic

Description

@yarikoptic
(deno) yoh@typhon:/mnt/DATA/data/yoh/1076_spacetop$ duct deno run --allow-read --allow-env --reload -A https://github.com/bids-standard/bids-validator/raw/deno-build/bids-validator.js --outfile logs/deno-bids-validator.log $PWD
2025-01-28T16:13:33-0500 [INFO    ] con-duct: duct is executing 'deno run --allow-read --allow-env --reload -A https://github.com/bids-standard/bids-validator/raw/deno-build/bids-validator.js --outfile logs/deno-bids-validator.log /mnt/DATA/data/yoh/1076_spacetop'...
2025-01-28T16:13:33-0500 [INFO    ] con-duct: Log files will be written to .duct/logs/2025.01.28T16.13.33-3649011_
Download https://github.com/bids-standard/bids-validator/raw/deno-build/bids-validator.js
Download https://raw.githubusercontent.com/bids-standard/bids-validator/deno-build/bids-validator.js
error: Uncaught (in promise) NotFound: No such file or directory (os error 2): writefile 'logs/deno-bids-validator.log'
    var ESCAPE = "\\";
           ^
    at writeFileSync (ext:deno_fs/30_fs.js:899:3)
    at Object.writeTextFileSync (ext:deno_fs/30_fs.js:962:10)
    at main (https://raw.githubusercontent.com/bids-standard/bids-validator/deno-build/bids-validator.js:46:12)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async https://raw.githubusercontent.com/bids-standard/bids-validator/deno-build/bids-validator.js:3:16
2025-01-28T16:23:20-0500 [INFO    ] con-duct: Summary:
Exit Code: 1
Command: deno run --allow-read --allow-env --reload -A https://github.com/bids-standard/bids-validator/raw/deno-build/bids-validator.js --outfile logs/deno-bids-validator.log /mnt/DATA/data/yoh/1076_spacetop
Log files location: .duct/logs/2025.01.28T16.13.33-3649011_
Wall Clock Time: 586.905 sec
Memory Peak Usage (RSS): 607.9 MB
Memory Average Usage (RSS): 529.4 MB
Virtual Memory Peak Usage (VSZ): 21.1 GB
Virtual Memory Average Usage (VSZ): 21.1 GB
Memory Peak Percentage: 0.0%
Memory Average Percentage: 0.0%
CPU Peak Usage: 100.0%
Average CPU Usage: 80.02024432809782%

so it took about 10 minutes to crash the process, since logs/ folder for --outfile path does not exist. I do not think it would be worthwhile to open the file earlier in the process, since process could just crash before getting anything output. But I think it would be nice if leading paths were automagically created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions