Commit c4cee7cb authored by Nigel Kukard's avatar Nigel Kukard

Reworked the loading of files

parent 15aa0af0
......@@ -38,7 +38,7 @@ test_job:
- awitpt/bin/convert-tsql sqlite database/schema.tsql > database/schema.sqlite
- sqlite3 wiaflos.sqlite < database/schema.sqlite
# Load data
- ./wiaflos-admin --config=wiaflos-server.conf --connect="local" --stdin < build/combined.wiaflos
- ./wiaflos-admin --config=wiaflos-server.conf --connect="local" --load-file build/combined.wiaflos
# Artifacts
artifacts:
expire_in: 1 day
......
......@@ -42,7 +42,7 @@ GetOptions(
"connect=s",
"stdin",
"load-file=s",
"help"
);
......
......@@ -150,15 +150,22 @@ sub ui_start
}
# Check if we using raw stdin
if (defined($cmdline->{'stdin'})) {
# Read from stdin
while (my $line = <STDIN>) {
# Chomp off newline
chomp($line);
# Process command
if (my $res = processCommand($OUT,$line) < 0) {
exit 1;
if (defined(my $file = $cmdline->{'load-file'})) {
# - is a special filename used for STDIN
if ($file eq "-") {
# Read from stdin - hack as we don't have a function
while (my $line = <STDIN>) {
# Chomp off newline
chomp($line);
# Process command
if (my $res = processCommand($OUT,$line) < 0) {
exit 1;
}
}
# For everything else try open the file
} else {
# Exit with code given by the loadFile function
exit loadFile(\*STDERR,{ 'file' => $file });
}
# Exit normally
exit 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment