Hi All,

Request your help on how to call a function(listFile) from another function(getFilelist) within the same class(GetDirlist), below is an example code.

Code:

class GetDirlist {

@system private auto listFile(immutable string st)
{
 auto fl = execute(["ls","-l"]);
 enforce(fl.status == 0, format("File not Found: %s", fl.status));
 return fl.output;
}

@system public auto getFilelist()
{
  Array!string amidata;
  auto flstore = Array!string("/path1/Dir1", "path2/Dir2");
  foreach(st; parallel(flstore,1)) {
     auto fltask = task!listFile(st);
     fltask.executeInNewThread();
     amidata.insert(fltask.yieldForce);
  }
  return amidata[];
}
}

void main() {
writeln(getFilelist());
}

From,
Vino.B

Reply via email to