Commit 4ba58747 authored by Donald Chen's avatar Donald Chen
Browse files

handle get sn error gracefully.

parent f000d074
......@@ -342,14 +342,14 @@ function requestHandler(req, res) {
} else {
exec ('/usr/bin/unit_serial_number', function (error, stdout, stderr) {
var sn = stdout.trim();
if(!sn) {
if(error || !sn ) {
console.log("error getting serial number!", error);
sn = "unknown"
}
var res_str = getStateBasedIndexPage();
var host_url = sn + ".local";
var host_port = NODE_RED_PORT.toString().trim();
console.log("host_url=%s, port=%s", host_url, host_port);
res_str = res_str.replace(/params_hostname/g, host_url);
res_str = res_str.replace(/params_node_red_http_port/g, host_port);
......
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